package com.crr.mall.product.config;

import org.aspectj.weaver.ast.Var;
import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.io.IOException;

@Configuration
public class MyRedissonConfig {
    @Bean
    RedissonClient redisson() throws IOException {
        Config config = new Config();
//        config.useClusterServers()
//                .addNodeAddress("127.0.0.1:7004","127.0.0.1:7001");//使用Redis集群模式
//        return Redisson.create(config);
        //创建配置
        config.useSingleServer().setAddress("redis://192.168.75.130:6379");
        //根据redisson创建实例
        return Redisson.create(config);
    }
}
